<?php
/** 
 * $Source: /cvsroot/pn-commerce/pn-commerce/pntemplates/plugins/function.pncIdentifyMethod.php,v $
 * $Author: landseer $
 * $Revision: 1.3 $
 * $Date: 2004/09/09 16:23:23 $
 *
 * Type: Function
 *
 * identifies a method by calling its info() function
 * @return string 
 */
function smarty_function_pncIdentifyMethod($params, &$smarty)
{
    extract($params);
    if( !$method )
    {
        return "*** error: missing parameter 'method' ***";
    }
    // lets see if we have a generic method
    $generic = split( "_", $method);
    if( ( $generic[0] == "smgeneric" ) || ( $generic[0] == "pmgeneric" ) || ( $generic[0] == "smups" ) )
    {
        $method = $generic[0];
        $data = $generic[1];
    }

    if( pnModAPILoad( 'pncommerce', $method ) )
    {
        return pnModAPIFunc( 'pncommerce', $method, 'info', array( 'method' => $data ) );
    }
    else
    {
        return "*** error: cannot load API file for $method ***";
    }
}
?>
